package net.mihome.app.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Created by zhao on 2015/2/7.
 * "description": "是兄弟就来",
 "membersonly": "true",
 "name": "打架一起来",
 "maxusers": "200",
 "allowinvites": "false",
 "groupname": "打架一起来",
 "groupid": "1421586644920",
 "public": "true",
 "affiliations_count": "5"
 */
public class Group implements Serializable{
    private String description;
    private String membersonly;
    private String maxusers;
    private String allowinvites;
    private String groupname;
    private String groupid;
    private String ispublic;
    private String affiliations_count;

    public static List<Group> parseList(List<Map> maps){
        if(maps==null){
            return null;
        }else{
            List<Group> groups=new ArrayList<>();
            Iterator<Map> mapIterator=maps.iterator();
            while(mapIterator.hasNext()){
                Map map=mapIterator.next();
                Group group=parse(map);
                groups.add(group);
            }
            return groups;
        }
    }

    public static Group parse(Map map){
        if(map!=null){
            Group group=new Group();
            group.setAffiliations_count((String) map.get("affiliations_count"));
            group.setAllowinvites((String) map.get("allowinvites"));
            group.setDescription((String) map.get("description"));
            group.setGroupid((String) map.get("groupid"));
            group.setGroupname((String) map.get("name"));
            return group;
        }else{
            return null;
        }
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getMembersonly() {
        return membersonly;
    }

    public void setMembersonly(String membersonly) {
        this.membersonly = membersonly;
    }




    public String getMaxusers() {
        return maxusers;
    }

    public void setMaxusers(String maxusers) {
        this.maxusers = maxusers;
    }

    public String getAllowinvites() {
        return allowinvites;
    }

    public void setAllowinvites(String allowinvites) {
        this.allowinvites = allowinvites;
    }

    public String getGroupname() {
        return groupname;
    }

    public void setGroupname(String groupname) {
        this.groupname = groupname;
    }

    public String getGroupid() {
        return groupid;
    }

    public void setGroupid(String groupid) {
        this.groupid = groupid;
    }

    public String getIspublic() {
        return ispublic;
    }

    public void setIspublic(String ispublic) {
        this.ispublic = ispublic;
    }

    public String getAffiliations_count() {
        return affiliations_count;
    }

    public void setAffiliations_count(String affiliations_count) {
        this.affiliations_count = affiliations_count;
    }
}
